/**
 * Copyright (c) 2016-2019 九点科技 All rights reserved.
 *
 * http://www.9dyun.cn
 *
 * 版权所有，侵权必究！
 */
package com.dian.modules.pos.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dian.common.validator.group.AddGroup;
import com.dian.common.validator.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import com.dian.common.entity.BaseEntity;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
/**
 * 采购订单
 *
 * @author xiaolai
 * @email xiaolai@9dyun.cn
 * @date 2019-07-01 23:37:45
 */
@Data
@TableName("pos_purchase_head")
public class PurchaseHeadEntity extends BaseEntity {
	private static final long serialVersionUID = 1L;

    /**
	 * 单据编码
	 */
    @NotBlank(message="单据编码不能为空",  groups ={AddGroup.class, UpdateGroup.class})
    @Length(max=20,  groups ={AddGroup.class, UpdateGroup.class}, message="单据编码长度不能超过20个字符")
    private String purchaseNo;



    /**
	 * 单据日期;format:yyyy-MM-dd;readonly
	 */
    @JsonFormat( pattern="yyyy-MM-dd")
    @NotNull(message="单据日期不能为空",groups = {AddGroup.class,UpdateGroup.class})
    private Date purchaseDate;



    /**
	 * 供应商id;来源于Base_Supplier.id
	 */
    @NotNull(message="供应商id不能为空",groups = {AddGroup.class,UpdateGroup.class})
    private Long supplierId;



    /**
	 * 供应商名称;来源于Base_Supplier.Supplier_Name
	 */
    @NotBlank(message="供应商名称不能为空",  groups ={AddGroup.class, UpdateGroup.class})
    @Length(max=60,  groups ={AddGroup.class, UpdateGroup.class}, message="供应商名称长度不能超过60个字符")
    private String supplierName;



    /**
	 * 采购员Id;来源于sys_user.id
	 */
    @NotNull(message="采购员Id不能为空",groups = {AddGroup.class,UpdateGroup.class})
    private Long guideId;



    /**
	 * 采购员名称;来源于sys_user.user_name
	 */
    @NotBlank(message="采购员名称不能为空",  groups ={AddGroup.class, UpdateGroup.class})
    @Length(max=40,  groups ={AddGroup.class, UpdateGroup.class}, message="采购员名称长度不能超过40个字符")
    private String guideName;



    /**
	 * 订单类型:1-产品-PRODUCT;2-辅料-ACCES
	 */
    @NotNull(message="订单类型不能为空",groups = {AddGroup.class,UpdateGroup.class})
    private Integer purchaseType;



    /**
	 * 订单状态:1-未审核-WAITCHECK;2-已审核-AUDITED-;99-已作废-INVALID;readonly
	 */
    @NotNull(message="订单状态不能为空",groups = {AddGroup.class,UpdateGroup.class})
    private Integer purchaseState;



    /**
	 * 审核人ID
	 */
    private Long checkUserId;



    /**
	 * 审核人;readonly
	 */
    @Length(max=40,  groups ={AddGroup.class, UpdateGroup.class}, message="审核人长度不能超过40个字符")
    private String checkUserName;



    /**
	 * 审核时间;format:yyyy-MM-dd HH:mm:ss;readonly
	 */
    @JsonFormat( pattern="yyyy-MM-dd HH:mm:ss")
    private Date checkDate;



    /**
	 * 未入库总基础数量
	 */
    private BigDecimal inSumNum;



    /**
	 * 总基础数量
	 */
    private BigDecimal sumNum;



    /**
     * 采购订单明细
     */
    @TableField(exist = false)
    private List<PurchaseLineEntity> purchaseLineEntityList;
}
